<include file="Public:header" />
<form class="form-inline definewidth m20" action="{:U('User/Index')}" method="get">
    维保人员名称：
    <input type="text" name="condition" id="username"class="abc input-default" placeholder="" value="{$condition}">&nbsp;&nbsp;
    <button type="submit" class="btn btn-primary">查询</button>&nbsp;&nbsp; <button type="button" class="btn btn-success" id="addnew">信息录入</button>
</form>
<table class="table table-bordered table-hover definewidth m10">
    <thead>
    <tr>
        <th>员工编号</th>
        <th>姓名</th>
        <th>入职时间</th>
        <th>性别</th>
        <th>职位</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    </thead>
    <foreach name="list" item="l_val">
        <tr>
            <td>{$l_val.user_id}</td>
            <td>{$l_val.nickname}</td>
            <td>{$l_val.work_time|date='Y-m-d',###}</td>
            <td>
                <if condition="$l_val['gender'] eq 1">
                    男
                    <else />
                    女
                </if>
            </td>
            <td>{$l_val.rolename}</td>
            <td>
                <if condition="$l_val['status'] eq 1">
                    在职
                    <else />
                    离职
                </if>
            </td>
            <td>
                <a href="{:U('User/view',array('uid'=>$l_val['user_id']))}" title="查看" ><icon class="icon-eye-open" ></icon></a>
                <a href="{:U('User/edit',array('uid'=>$l_val['user_id']))}" title="编辑" ><icon class="icon-edit" ></icon></a>
                <a href="javascript:delete_user({$l_val['user_id']})" title="删除"><icon class="icon-trash" ></icon></a>
                <!-- <a href="{:U('User/comment',array('uid'=>$l_val['user_id']))}" title="评分"><icon class="icon-comment" ></icon></a> -->
            </td>
        </tr>
    </foreach>

</table>
<script>
    $(function () {

        $('#addnew').click(function(){

            window.location.href="{:U('User/add')}";
        });
    });

    function delete_user(id)
    {


        if(confirm("确定要删除吗？"))
        {
            $.get("{:U('User/delete',array('uid'=>$l_val['user_id']))}",function (xhr) {
                if(200 == xhr.status){
                    alert(xhr.msg);
                    window.location.href="{:U('User/Index')}";
                }else{
                    alert(xhr.msg);
                }
            });
        }
    }
</script>

<include file="Public:footer" />

